package sctu.edu.java.year2016.team08.zengshenjing.day20160522.chapter6_1;

/**
 * Created by Administrator on 2016/5/22.
 * 判断字符串中I 的个数
 *
 */
public class chapter6_1 {
    public static void main(String[] args) {
        int b,y=0,count=0;
        char i;
        char a[]={'m','i','n','g','r','i','r','i','k','e','j','i','j','a','v','a','b','b'};//创建一个字符串数组
        String s=new String (a);
        b=s.length();//计算字符串长度
            for(y=0;y<b;y++) {
                if (a[y] == 'i')
                    count++;//计数器
            }
        System.out.println(count);

    }
}
